<?php
session_start();
$a = isset($_SESSION['islogin']) ? $_SESSION['islogin'] : 0;
if ($a != 1) {
    die('<script>alert("请先登陆");window.location.href="message.php"</script>');
}
$message = isset($_POST['content']) ? $_POST['content'] : '';
$name    = isset($_POST['uname']) ? $_POST['uname'] : '';
$ctime   = time();
@mysql_connect('localhost', 'root', 'root');
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "insert into `message` (`message`,`ctime`,`name`) value ('$message','$ctime','$name')";
$res = mysql_query($sql);
if ($res) {
    echo "<script>window.location.href='message.php'</script>";
}
